package ref;

import org.junit.Test;

import java.util.Arrays;
import java.util.function.Function;

/**
 * @Author com.alibaba.lizhen
 * @Date 2021/3/23 10:33 下午
 * @Version 1.0
 * @Description
 * 数组引用
 *  语法：
 *
 *      Type :: new;
 */
public class ArrayRefTest {

    @Test
    public void test(){
        // 数组引用
        Function<Integer, String[]> fun = (x) -> new String[x];
        Function<Integer, String[]> fun2 = String[]::new;
        String[] strArray = fun2.apply(10);
        Arrays.stream(strArray).forEach(System.out::println);
    }
}
